<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="referrer" content="never">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />   
    <title>{{ config('app.name', '.') }}</title>
    <link type="text/css" rel="stylesheet" href="/libs/HUI-master/css/hui.css" />
    <style type="text/css">
        .bgGreen{background:#1BC5BB !important;}
        .bgRed{background:#FF6347 !important;}
        .category{    width: 18%;
            height: 24px;
            border-radius: 8px;
            font-weight: bold;
            text-align: center;
            color: #FFF;
            line-height: 24px;
            font-size: 17px;
            margin:2px;
            background: #CC00FF;}
        #list2 li{width:50%; float:left; 0px;}
        #list2 .hui-img-list-content{padding:5px; padding-bottom:10px;}
        #list2 h1{font-size:14px;}
        #hui-load-more {
            margin-bottom:50px;
        }
        .to-top{
            position: fixed;
            border-radius: 50%;
            z-index: 20;
            bottom: 100px;
            background: rgba(1,9,9,0.4);
            width:45px;
            height:45px;
            color: #fff;
            display:flex;
            justify-content: center;
            align-items:center;
            font-size:12px;
            right:10px;
            font-weight:bold;
        }
        .hui-scroll-news-items{
            color: #A0522D;font-weight: bold;
        }
        .buy-button {
            position: relative;
            background: linear-gradient(5deg, red, gold);
            z-index: 1;
            border-radius: 5px;
            padding: 4px 6px;
        }
        .buy-button::after {
            content: '';
            width: 100%;
            height: 100%;
            position: absolute;
            background: inherit;
            top: 0.5rem;
            filter: blur(0.4rem);
            opacity: 0.7;
            z-index: -1;
        }
        .time{
            font-size: 12px;
            height: 16px;
            line-height: 16px;
            margin-top: -16px;
            color: yellow;
            padding-left: 5px;
            z-index: 99;
            font-weight: bold;
        }
        .video-item{
            z-index: 99;
        }
        @keyframes ani {
            0% {
            	transform: scale(0.9,0.9);
            	opacity:1;
            	background-color:#fff;  
            	color:red;
            }
            25% {
            	transform:scale(1,1);
            	opacity:0.9;
            	background-color:yellow; 
            	color:red;
            }
            50% {
            	transform:scale(0.9,0.9);
            	opacity:1;
            	background-color:#fff;  
            	color:red;
            }
            75% {
            	transform:scale(1,1);
            	opacity:0.9;
            	background-color:yellow; 
            	color:red;
            }
            100% {
            	transform:scale(0.9,0.9);
            	opacity:1;
            	background-color:#fff;  
            	color:red;
            }
        }
    </style>
</head>
<body>
    <div id='show-out-video' style="display:none;">
        <div id='outvideo'>
            <div class='video-player' style="height:140px;"></div>
        </div>
    </div>
    <div id="refreshContainer" class="hui-refresh">
        <div class="hui-refresh-icon"></div>
        <div class="hui-refresh-content">
            <div class="hui-wrap menus" id='menus' style="z-index:999;">
                <div class="hui-flex" id='categories' style="flex-wrap:wrap;justify-content: space-around;background:#fff;">
                    @foreach($categories as $category)
                      <div class="category" data-id="{{$category['id']}}" data-title="{{xor_enc($category['c_name'])}}" onclick='loadCategory(this)'>{{xor_enc($category['c_name'])}}</div>
                    @endforeach
                </div>
                <div class="hui-flex" style="flex-wrap:wrap;justify-content: center;background:#fff;z-index:999;">
                    <div class="category bgRed" onclick='loadRandom()'>全部</div>
                    <div class="category bgRed"  onclick='sellTop()'>热播</div>
                    <a class="category bgRed"  href="/tag-videos?code={{$code}}">已评价</a>
                    <header class="" style="display:flex;background: gold;border-radius: 5px;align-items: center;margin-left: 8px;">
                        <div id="hui-header-sreach" style="border-radius: 5px;height: 26px;margin: 1px 2px;display: flex;background: #fff;">
                            <div style='width:100px;'>
                            <input type="search"  id="searchKey" placeholder="请输入关键字" style="font-weight: bold;color: black;height: 25px !important;line-height: 25px !important;border: 0;font-size: 12px;text-indent: 10px;" /></div>
                        </div>
                        <div style="color: red;font-weight: bold;flex-shrink: 0;font-size: 14px;margin: 6px;" onclick="search()">搜索</div>
                    </header>
                </div>
            </div>
            <div style="background:#FFF; padding:0px 15px; margin-top:8px;" class="hui-flex notice">
                <div style="height:46px; width:20px;">
                    <img src="/images/mobile/notice.png" width="20" style="padding:13px 0px;" />
                </div>
                <div class="hui-scroll-news" id="news">
                    @foreach($notices as $notice)
                          <div class="hui-scroll-news-items">{{$notice['content']}}</div>
                    @endforeach
                </div>
            </div>
            <div class="hui-wrap">
                <div class="hui-img-list" id="list2" style="padding:10px 5px;">
                    <ul id='video_list'>
                        @if($pic_type=='encode_img')
                            <script>
                                function preView(blob,element){
                                    let reader    = new FileReader();
                                    reader.readAsDataURL(blob);
                                    reader.onload = function(e) {
                                        element.src = e.target.result;
                                    }
                                }
                                function jsReadFiles(blob,element) {
                                    var reader = new FileReader();//new一个FileReader实例
                                    if(/image+/.test(blob.type)) {//判断文件是不是imgage类型
                                        reader.readAsArrayBuffer(blob);
                                        reader.onload = function() {
                                            var result  = new Blob([this.result.slice(4)], {type: 'image/jpeg'});
                                            preView(result,element);
                                        }
                                    }
                                }
                                function resetImgUrl(imgObj,maxErrorNum){
                                    let xmlhttp=new XMLHttpRequest();
                                    xmlhttp.open("GET",imgObj.getAttribute("src2")+'_.jpg',true);
                                    xmlhttp.responseType = "blob";
                                    xmlhttp.onreadystatechange = function () {
                                        if (xmlhttp.readyState == xmlhttp.DONE) {
                                            if (xmlhttp.status == 200) {
                                                jsReadFiles(xmlhttp.response,imgObj);
                                                imgObj.onerror=null;
                                            }
                                        }
                                    };
                                    xmlhttp.send(null);
                                }
                            </script>
                            @foreach($videos as $video)
                            <li>
                                <div class='video-item' 
                                    data-time = "{{$video['time']}}"
                                    data-videourl="{{($video['url'])}}" 
                                    data-title="【{{xor_enc($video['_category'])}}】{{xor_enc($video['c_title'])}}" 
                                    data-url="/pay?code={{$code}}&video_id={{$video['id']}}" >
                                    <img class="image vpic" alt=""  style="height:130px" src='' src2="http://{{$img_cdns['img_cdn1']['domain']}}/{{$video['face_img']}}" onerror='resetImgUrl(this,3)'/>
                                    <div class='time'>时长 {{$video["time"]}}</div>
                                    <div class="hui-img-list-content" style="padding-bottom:0;">
                                        <h1 style="font-weight:800;black:red;line-height: 18px;height: 36px;overflow: hidden;">【{{xor_enc($video['_category'])}}】{{xor_enc($video['c_title'])}}</h1>
                                        <h1 style="color:green;font-weight:bold;margin-top:3px;font-size: 12px;">
                                            <!--<text class="hui-icons hui-icons-eyes" style="color: green !important;font-size: 12px;padding-right: 0px;"></text>-->
                                            {{$video["play_count"]}} 人已观看<span style="color:red;font-size:12px;">￥{{$price}}</span></h1>
                                    </div>
                                </div>
                            </li>
                            @endforeach
                        @elseif($pic_type=='db_base64')
                            @foreach($videos as $video)
                            <li>
                                <div class='video-item' 
                                    data-time = "{{$video['time']}}"
                                    data-title="【{{xor_enc($video['_category'])}}】{{xor_enc($video['c_title'])}}" 
                                    data-url="/pay?code={{$code}}&video_id={{$video['id']}}" >
                                    <img class="lazy image vpic" style="height:130px" src="{{$video['base64']}}"/>
                                    <div class='time'>时长 {{$video["time"]}}</div>
                                    <div class="hui-img-list-content" style="padding-bottom:0;">
                                        <h1 style="font-weight:800;black:red;line-height: 18px;height: 36px;overflow: hidden;">【{{xor_enc($video['_category'])}}】{{xor_enc($video['c_title'])}}</h1>
                                        <h1 style="color:green;font-weight:bold;margin-top:3px;font-size: 12px;">
                                            <!--<text class="hui-icons hui-icons-eyes" style="color: green !important;font-size: 12px;padding-right: 0px;"></text>-->
                                            {{$video["play_count"]}} 人已观看<span style="color:red;font-size:12px;">￥{{$price}}</span></h1>
                                    </div>
                                </div>
                            </li>
                            @endforeach
                        @else
                            @foreach($videos as $video)
                            <li>
                                <div class='video-item' 
                                    data-time = "{{$video['time']}}"
                                    data-title="【{{xor_enc($video['_category'])}}】{{xor_enc($video['c_title'])}}" 
                                    data-url="/pay?code={{$code}}&video_id={{$video['id']}}" >
                                    <img class="image vpic" alt=""  style="height:130px" src="http://{{$img_domain}}/{{$video['face_img']}}.jpg" />
                                    <div class='time'>时长 {{$video["time"]}}</div>
                                    <div class="hui-img-list-content" style="padding-bottom:0;">
                                        <h1 style="font-weight:800;black:red;line-height: 18px;height: 36px;overflow: hidden;">【{{xor_enc($video['_category'])}}】{{xor_enc($video['c_title'])}}</h1>
                                        <h1 style="color:green;font-weight:bold;margin-top:3px;font-size: 12px;">
                                            <!--<text class="hui-icons hui-icons-eyes" style="color: green !important;font-size: 12px;padding-right: 0px;"></text>-->
                                            {{$video["play_count"]}} 人已观看 <span style="color:red;font-size:12px;">￥{{$price}}</span></h1>
                                    </div>
                                </div>
                            </li>
                            @endforeach
                        @endif
                    </ul>
                </div>
            </div>  
        </div>  
    </div>
    <div class="to-top"  id="toTop" onclick="loadRandomCurrent()">摇一摇</div>
    <div id="hui-footer" style="display:flex;justify-content:space-around;font-weight:bold;background:#CC00FF;height:30px;align-items:center;">
        <div onclick='loadRecommand()'>
            <div class="hui-footer-text" style="color:#fff;font-size:16px;padding: 10px;">👍推荐</div>
        </div>
        <div onclick='loadAll()'>
            <div class="hui-footer-text" style="color:#fff;font-size:16px;padding: 10px;">👀最新</div>
        </div>
        <div onclick='loadBuy()'>
            <div class="hui-footer-text buy-button" style="color:#fff;font-size:16px;">🛒已购买</div>
        </div>
        <div onclick="backTop()">
            <div class="hui-footer-text" style="color:#fff;font-size:16px;padding: 10px;">↑回顶部</div>
        </div>
    </div>

    <div id="hui-black-mask" style="display: none;">
        <div id="hui-black-mask-content" style="position:fixed;transform: rotate(0deg);left:0;top:unset;bottom:0px;background:red;padding:5px 1%;padding-bottom:15px;border-top-right-radius: 10px;border-top-left-radius: 10px;">
            <div id="title" style="height: 45px;line-height:22.5px;color: #fff;width: 98vw;">
                付费观看
            </div>
            @if(config('visit.preview_video'))
                <div style="height: 30px;font-size: 20px;text-align: center;color:yellow;font-weight:bold;" id="view-tips">↓↓8秒试看↓↓</div>
            @else
                <div style="height: 18px;font-size: 14px;background:rgba(0,0,0,0.5);color:#fff;" id="view-tips"></div>
            @endif
            <div style="text-align:center;width:100%;position:relative">
                <div style="text-align:center;width:100%;position:relative;max-height: 70vh;padding-bottom: 0;">
                    @if(config('visit.preview_video'))
                        <div id='preview'>
                            <div class='video-prew' style="height:200px;"></div>
                        </div>
                    @else
                        <image class='now-pic' src="" style="max-height:70vh;width:100%;" />
                    @endif
                </div>
                <a class='todetail' href='' style="text-align:center; color:#FFFFFF; line-height:60px; margin-left: 30px;" >
                    <button id='btn-pay' style="filter:drop-shadow(0px 0px 0.5em yellow);margin:10px 0px;padding:8px 30px;background:gold;color:red;font-size:20px;font-weight:bold;border:none;border-radius:30px;animation-name: ani;animation-duration:2s;animation-iteration-count: infinite;">
                        付款 ￥{{$price}} 看整片
                    </button>
                </a>
                <div id="hui-black-close" style='margin-top:10px;float:right;margin-right:10px;' onclick='parse_video()'></div>
            </div>
        </div>
    </div>
    <script src="https://static-js001.oss-accelerate.aliyuncs.com/js/common/jquery.js?versionId=CAEQBxiBgMDz1erzwxciIGM4MzZhOGY1MWE0MDQ1OTliMDdkNDQzYTdhNjkxYzUz"></script>
    <script src="https://static-js001.oss-accelerate.aliyuncs.com/js-libs/HUI-master/js/hui.js?versionId=CAEQBxiBgMCdzejzwxciIDc5YTI5YjlkZjBmZjRjZDk5NGQzMTI3MDRhOGZmOTI4"></script>
    <script src="https://static-js001.oss-cn-guangzhou.aliyuncs.com/js-libs/HUI-master/js/hui-refresh-load-more.js?versionId=CAEQDBiBgMDstbeSyxciIDU1MDFiMmEzNGVmNjQxNTE5YzAzZmE1ZjIzZTlhYWI3"></script>
    <script src="/libs/ckplayer/ckplayer.min.js" data-name="ckplayer"></script>
    <script>
        videodomain ="{{$video_domain}}";
        previewvideo = "{{config('visit.preview_video')}}";
        _top = 5
        if(previewvideo && videodomain){
            _top = 145
            var prewVideoObject = {
                container: '.video-prew',
                variable: 'player',
                video: "http://1.com",
                // mobileAutoFull: false,
                poster: './images/mobile/pre_face.jpg',
            };
            var videoPreplayer = new ckplayer(prewVideoObject);
        }
        function parse_video(){
            if(previewvideo && "undefined" != typeof videoPreplayer){
                videoPreplayer.videoPause()
            }
        }
        
        //菜单吸顶
        // hui.onScroll(function(scrollTop){
        //     if(scrollTop>=_top){
        //         document.getElementById('menus').style.position='fixed';
        //         document.getElementById('menus').style.top= 0;
        //         $('.notice').css('margin-top','140px')
        //     }else{
        //         document.getElementById('menus').style.position='relative';
        //         $('.notice').css('margin-top','0px')
        //     }
        // });
    </script>
    <script src="/js/mobile/common.mix.js?001"  id='commonJs' price="{{$price}}"></script>
    <script src="/js/mobile/index.js?001"  id='indexJs' code="{{$code}}" out_video="{{$out_video}}" pic_type="{{$pic_type}}"></script>
</body>
</html>